package example.day03;

import java.util.Random;

/**
 * @author 涛哥
 * @nick_name "deep as the sea"
 * @contact qq:657270652 wx:doit_edu
 * @site www.doitedu.cn
 * @date 2021-03-04
 * @desc switch语句示例代码
 */
public class _06_Switch分支条件Demo {
    public static void main(String[] args) {
        Random r = new Random();
        int i = r.nextInt(10);

        i = 5;
        switch (i) {
            case 5:
                break;
            case 6:
                System.out.println("多易666");
                break;
            case 7:
                System.out.println("多易牛");
                break;
            case 8:
                System.out.println("多易让你发发发");
                break;
            case 9:
                System.out.println("多易恒永久");
                break;
            default:
                System.out.println("涛哥爱我,我爱涛哥");
                break;
        }

        System.out.println("-------古力娜扎的分割线---------");

        // case的穿透性
        i = 11;
        switch (i){
            case 5:
            case 6:
            case 7:
                System.out.println("5 6 7 都会打印我");
                break;
            case 8:
            case 9:
            case 10:
                System.out.println("8 9 10 都打印我");
                break;
            default:
                System.out.println("我是别的");
                break;
        }

        /**
         *
         */
        int a = 10;
        switch (a){
            case 10:
                //
                break;
        }

        byte b = 1;
        switch (b){
            case 1:
                break;
        }

        short s = 1;
        switch (s){
            case 1:
                break;
        }


        char c = 'u';
        switch (c){
            case 'u':
                // do some thing
                break;
        }

        /**
         * Incompatible types. Found: 'boolean',
         * required:
         * -- 基本类型
         * 'char, byte, short,int,
         *
         * -- 引用类型
         * Character, Byte, Short, Integer,
         * String（字符串类型）, or an enum（枚举类型）'
         */
        boolean bl = true;
        // ctr+shift+/ 快速进行 多行 注释
        /*switch (bl){
            case true:
        }*/

        System.out.println("-------------乘风破浪的姐姐------------");
        String str = "doitedu";
        switch (str){
            case "doitedu":
                System.out.println("多易教育");
                break;
            case "taoge":
                System.out.println("涛哥");
                break;
            case "qingyicheng":
                System.out.println("多易教育的班花");
                break;
            default:
                System.out.println("多易教育的班草");
        }


    }
}
